home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
pdcurs21
/
portable
/
doupdate.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-18
|
3KB
|
111 lines
#define CURSES_LIBRARY 1
#include <curses.h>
#undef doupdate
#ifdef PDCDEBUG
char *rcsid_doupdate = "$Header: C:\CURSES\portable\RCS\doupdate.c 2.1 1993/06/18 20:19:47 MH Rel MH $";
#endif
/*man-start*********************************************************************
doupdate() - do effiecient refresh
X/Open Description: (part of the wnoutrefresh() description.)
These two routines allow multiple updates with more efficiency
than wrefresh() alone. In addition to all of the window
structures representing the terminal screen: a physical screen,
describing what is actually on the screen and a virtual screen,
describing what the programmer wants to have on the screen.
The wrefresh() function works by first calling wnoutrefresh(),
which copies the named window to the virtual screen. It then
calls doupdate(), which compares the virtual screen to the
physical screen and does the actual update. If the programmer
wishes to output several windows at once, a series of cals to
wrefresh() will result in alternating calls to wnoutrefresh()
and doupdate(), causing several bursts of output to the
screen. By first calling wnoutrefresh() for each window, it
is then possible to call doupdate() once. This results in
only one burst of output, with probably fewer total characters
transmitted and certainly less CPU time used.
PDCurses Description:
In addition to the above, if REGISTERWINDOWS is TRUE when the
library was compiled, any windows registered (true by default
with PDCurses and _cursvar.refreshall is TRUE, then all
registered windows will be called via wnoutrefresh() before
the actual screen update begins.
X/Open Return Value:
The doupdate() function returns OK on success and ERR on error.
X/Open Errors:
No errors are defined for this function.
Portability:
PDCurses int doupdate( void );
X/Open Dec '88 int doupdate( void );
BSD Curses int doupdate( void );
SYS V Curses int doupdate( void );
**man-end**********************************************************************/
int doupdate(void)
{
register int i;
#ifdef REGISTERWINDOWS
WINDS* next = _cursvar.visible;
#ifdef PDCDEBUG
if (trace_on) PDC_debug("doupdate() - called\n");
#endif
if (_cursvar.refreshall)
{
while (next != NULL)
{
if (next->w->_parent != NULL)
{
touchwin(next->w->_parent);
wnoutrefresh(next->w->_parent);
}
touchwin(next->w);
wnoutrefresh(next->w);
next = next->next;
}
}
#endif
if (_cursvar.shell)
reset_prog_mode();
if (curscr == (WINDOW *)NULL)
return( ERR );
if (curscr->_clear)
{
PDC_clr_update(curscr);
}
else
{
for (i = 0; i < LINES; i++)
{
if (curscr->_firstch[i] != _NO_CHANGE)
/*****************************************************/
/* Turn off checking for premature end of refresh */
/*****************************************************/
/*
if (PDC_transform_line(i))
break;
*/
PDC_transform_line(i);
}
}
curscr->_curx = curscr->_curx;
curscr->_cury = curscr->_cury;
PDC_gotoxy(curscr->_cury, curscr->_curx);
_cursvar.cursrow = curscr->_cury;
_cursvar.curscol = curscr->_curx;
return( OK );
}